﻿@using MvcAtletIS.Helpers;
@model IEnumerable<MvcAtletIS.Models.Categories>
@{
    ViewBag.Title = "Kategórie";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section head {

    <link href="@Url.Content("~/footable/css/footable.core.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/footable/css/footable.standalone.css")" rel="stylesheet" type="text/css" />
  
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
    <script src="@Url.Content("~/footable/js/footable.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/footable/js/footable.sort.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/footable/js/footable.filter.js")" type="text/javascript"></script>
    
    <script type="text/javascript">
        $(function () {
            $("table").footable();

            $(".clear-filter").click(function (e) {
                e.preventDefault();
                $("table").trigger("footable_clear_filter");
            });
        });
    </script>
}

<h2>Kategórie</h2>

<div class="filter-frame">
        
    <div class="filter-item">
        <div class="editor-label">
            Vyhľadávanie:
        </div>
        <div class="editor-field">
            @Html.TextBox("text-filter")
        </div>
    </div>

    <div class="filter-item">
        <div class="editor-label">
            <a href="#clear" class="clear-filter" title="clear filter">Zrušiť filter</a>
        </div>
    </div>

</div>

<p>
    @Html.ActionLink("< Administrácia", "Index", "Home", new { area = "Admin" }, null) |
    @Html.ActionLink("Pridať novú kategóriu", "Create")
</p>

<table class="footable table toggle-arrow-tiny" data-filter="#text-filter" data-filter-minimum="3">
    <thead>
        <tr>
            <th data-class="expand">
                Skratka
            </th>
            <th data-sort-initial="ascending">
                Názov
            </th>
            <th>
                Alternatívny názov
            </th>
            <th width="60px" data-sort-ignore="true">
                Aktívna
            </th>
            <th data-hide="phone,tablet">
                Pohlavie
            </th>
            <th data-hide="phone,tablet">
                Rok od
            </th>
            <th data-hide="phone,tablet">
                Rok do
            </th>
            <th data-hide="phone,tablet">
                Bodovanie
            </th>
            <th width="70px" data-sort-ignore="true"></th>
        </tr>
    </thead>
    <tbody>
    @foreach (var item in Model) 
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.CodeName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.AlterName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Active)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Sex)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.YearFrom)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.YearTo)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Points)
            </td>
            <td>
                @Html.ImageActionLink(Url.Content("~/Content/icons/preview.gif"), "", "Details", new { id = item.ID }, new { title = "Zobraziť", border = 0, hspace = 2 }) |
                @Html.ImageActionLink(Url.Content("~/Content/icons/edit.gif"), "", "Edit", new { id = item.ID }, new { title = "Editovať", border = 0, hspace = 2 })
            </td>
        </tr>
    }
    </tbody>
</table>